package dbmig.model;


import org.jetbrains.annotations.NotNull;



/**
 * Table of database.
 */
public abstract class AbstractEntity
{

    @NotNull
    private AbstractContext context;


    /**
     * Logical name.
     * Logical name is a system-independent name,
     * that is used when schema is migrated from one RDBMS to another.
     */
    @NotNull
    private String name;


    /**
     * Logical name.
     * <p>
     * Logical name is a system-independent name,
     * that is used when schema is migrated from one RDBMS to another.
     * </p>
     * @return logical name.
     */
    @NotNull
    public String getName()
    {
        return name;
    }


    /**
     * Sets the logical name.
     * @see #getName()
     * @param name logical name.
     */
    @NotNull
    public void setName(final @NotNull String name)
    {
        this.name = name;
    }


    /**
     * Catalog name.
     * <p>
     * Catalog name is an RDBMS-specific name,
     * that is shown by RDBMS metadata catalog views.
     * </p>
     * @return catalog name.
     */
    @NotNull
    public String getCatalogName()
    {
        return context.convertLogicNameToCatalog(name);
    }


    /**
     * Sets the catalog name.
     * @see #getCatalogName()
     * @param catalogName  catalog name.
     */
    public void setCatalogName(final @NotNull String catalogName)
    {
        name = context.convertCatalogNameToLogic(catalogName);
    }


    /**
     * Script name.
     * <p>
     * Script name is an RDBMS-specific name,
     * that is used in SQL scripts.
     * </p>
     * @return script name.
     */
    @NotNull
    public String getScriptName()
    {
        return context.convertLogicNameToScript(name);
    }



}
